﻿@using System.Web.UI.WebControls
@model GioHangViet.Models.User
@{
    ViewBag.Title = "Create";
}
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/js/User.js")" type="text/javascript"></script>
<div class="row-fluid">
    <div class="span7">
        <div class="widget-block">
            <div class="widget-head">
                <h5>
                    Đăng ký user</h5>
            </div>
            <div class="widget-content">
                <div class="widget-box">
                    @using (Html.BeginForm("Create", "Users", FormMethod.Post, new { @class = "form-horizontal well white-box" }))
                    {
                        @Html.ValidationSummary(true)
                        <fieldset>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.UserName)
                                </div>
                                <div class="controls">
                                    @Html.TextBoxFor(model => model.UserName, new{ onchange = "CheckExsistUserName(this)" })
                                    @Html.ValidationMessageFor(model => model.UserName)
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.Password)
                                </div>
                                <div class="controls">
                                    @Html.EditorFor(model => model.Password)
                                    @Html.ValidationMessageFor(model => model.Password)
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.Label("Nhập lại mật khẩu:")
                                </div>
                                <div class="controls">
                                    <input type="password" value="" name="PasswordConfirm" id="PasswordConfirm" data-val-equalto="Passwords must match"
                                        data-val-equalto-other="Password" data-val-required="The Re-enter Password field is required."
                                        data-val="true" class="text-box single-line input-validation-error">
                                    <span data-valmsg-replace="true" data-valmsg-for="PasswordConfirm" class="field-validation-error">
                                    </span>
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.Email)
                                </div>
                                <div class="controls">
                                    @Html.TextBoxFor(model => model.Email, new { Onchange = "CheckExitEmail(this)"})
                                    @Html.ValidationMessageFor(model => model.Email)
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.Fullname)
                                </div>
                                <div class="controls">
                                    @Html.EditorFor(model => model.Fullname)
                                    @Html.ValidationMessageFor(model => model.Fullname)
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.Provice)
                                </div>
                                <div class="controls">
                                    @Html.DropDownList("Provice", (SelectList)ViewBag.Provice, "Chọn tỉnh...", new { onchange = "GetDistrict(this)", id = "proviceDropdownList" })
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.District)
                                </div>
                                <div class="controls">
                                    @Html.DropDownList("District", new SelectList(new ListItemCollection { "chọn huyện..." }), new { id = "DistrictDropdownList" })
                                    @Html.ValidationMessageFor(model => model.District)
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.Ward)
                                </div>
                                <div class="controls">
                                    @Html.EditorFor(model => model.Ward)
                                    @Html.ValidationMessageFor(model => model.Ward)
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.Avatar)
                                </div>
                                <div class="controls" style="width: 219px; padding-bottom: 20px;">
                                    <div class="thumbnail group1 cboxElement" id="ImageAvata">
                                        <img src="/Content/images/Avata/Default/1avata.gif" alt="sách, sách tiếng anh, sách ôn thi, truyện tranh, sách tiếng việt, sách mới, tiểu thuyết, trinh thám, sách hay, sách online" />
                                    </div>
                                </div>
                                <div class="controls" style="padding-bottom: 20px;">
                                    @Html.DropDownList("ImageAvata", (SelectList)ViewBag.ImagesAvata, new { onchange = "ChangeAvata(this)", id = "DropdownListAvata" })
                                </div>
                                <div class="controls">
                                    <input type="file" value="chọn avata..." accept="image/jpg,image/gif" onchange="chooseFlie()" />
                                    @Html.ValidationMessageFor(model => model.Avatar)
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.Birthday)
                                </div>
                                <div class="controls">
                                    @Html.TextBoxFor(model => model.Birthday, new { id = "datepicker" })
                                    @Html.ValidationMessageFor(model => model.Birthday)
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.Gender)
                                </div>
                                <div class="controls">
                                    @Html.RadioButtonFor(model => model.Gender, "1", new { @checked = "checked" }) Nam<br />
                                    @Html.RadioButtonFor(model => model.Gender, "0") Nữ<br />
                                    @Html.RadioButtonFor(model => model.Gender, "3") Khác<br />
                                    @Html.ValidationMessageFor(model => model.Gender)
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="control-label">
                                    @Html.LabelFor(model => model.TrackNews)
                                </div>
                                <div class="controls">
                                    @Html.EditorFor(model => model.TrackNews)
                                    @Html.ValidationMessageFor(model => model.TrackNews)
                                </div>
                            </div>
                            <div class="form-actions">
                                <input class="btn btn-primary" type="submit" value="Create" />
                                @Html.ActionLink("cancel", "Index", new { id = 1 }, new { @class = "btn" })
                            </div>
                        </fieldset>
                    }
                    <div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
